Exemplo n.º 1
0
static int test_led_power(void)
{
	/* Check LED is off */
	TEST_ASSERT(!lp5562_powered());

	/* Plug in AC, and LED should turn on within a second */
	set_ac(1);
	msleep(1500);
	TEST_ASSERT(lp5562_powered());

	/* Change state while AC is on. LED should keep on */
	set_charge_state(ST_CHARGING_ERROR);
	msleep(1500);
	TEST_ASSERT(lp5562_powered());

	/* Unplug AC. LED should turn off */
	set_ac(0);
	msleep(1500);
	TEST_ASSERT(!lp5562_powered());

	/* Plug AC again. LED should turn on */
	set_ac(1);
	msleep(1500);
	TEST_ASSERT(lp5562_powered());

	return EC_SUCCESS;
}
Exemplo n.º 2
0
void create() {
    :: create();
    set_ac(1);
    set_mass(10);
    set_curr_value("gold", 110);
    set_type("mask");
    set_limbs(({"head"}));
Exemplo n.º 3
0
void create() {
::create();
set_ac(0);
set_name("medalion");
set_long("This gold medalion belongs to Yakko for getting helping to defeat the "
"dark army.");
set_id(({"medallion", "yakkos medallion"}));
Exemplo n.º 4
0
void create_object(void)
{
    set_short("Dithe the pirate shopkeeper",1);
    set_long("Dithe is a drunken slob of a shopkeeper. You feel your " +
             "trading skill increase every time he stumbles or bumps " +
             "into a shelf as he tries to move around his shop.\n");
    set_name("dithe");
    add_id("man");
    add_id("shopkeeper");
    add_id("dithe the shopkeeper");
    set_level(2);
    set_race("human");
    set_hp(80);
    set_al(0);
    set_gender(1);
    set_wc(1);
    set_ac(0);
    add_money(200);

    load_chat(1,({ "Dithe stumbles.\n",
                   "Dithe bumps into a shelf.\n",
                   "Dithe takes a small bottle from a pocket and drinks " +
                   "from it when he thinks you're not looking.\n",
                   "Dithe mumbles something incomprehensible.\n"
                 }));
Exemplo n.º 5
0
void create() {
    :: create();
    set_ac(3);
    set_mass(15);
    set_curr_value("gold", 110);
    set_type("cloak");
    set_limbs(({"torso", "right arm", "left arm"}));
Exemplo n.º 6
0
static int test_bad_i2c(void)
{
	/* Make LED green */
	set_ac(1);
	set_charge_state(ST_DISCHARGING);
	set_battery_soc(95);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* Make it red, but fail the I2C write to green PWM register */
	lp5562_failed_i2c_reg = LP5562_REG_G_PWM;
	set_charge_state(ST_CHARGING_ERROR);
	msleep(3000);
	TEST_ASSERT(!verify_color(LED_COLOR_RED));

	/* I2C works again. LED should turn red */
	lp5562_failed_i2c_reg = -1;
	msleep(1500);
	TEST_ASSERT(verify_color(LED_COLOR_RED));

	/* Make it green, but I2C fails again */
	lp5562_failed_i2c_reg = LP5562_REG_R_PWM;
	set_charge_state(ST_DISCHARGING);
	msleep(1500);
	TEST_ASSERT(!verify_color(LED_COLOR_GREEN));
	TEST_ASSERT(!verify_color(LED_COLOR_RED));

	/* I2C works now, but LED turns red at the same time */
	lp5562_failed_i2c_reg = -1;
	set_charge_state(ST_CHARGING_ERROR);
	msleep(1500);
	TEST_ASSERT(verify_color(LED_COLOR_RED));

	return EC_SUCCESS;
}
Exemplo n.º 7
0
static int test_green_yellow(void)
{
	/* Make LED green */
	set_ac(1);
	set_charge_state(ST_CHARGING);
	set_battery_soc(95);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* Make it yellow now */
	set_battery_soc(90);
	msleep(1500);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));

	/* Shouldn't change from yellow to green in 15 seconds */
	set_battery_soc(95);
	msleep(13000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));

	/* After 15 seconds, it should turn green */
	msleep(3000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* Shouldn't change from green to yellow in 15 seconds */
	set_charge_state(ST_BAD_COND);
	msleep(12000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* After 15 seconds, it should turn yellow */
	msleep(4000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));

	return EC_SUCCESS;
}
Exemplo n.º 8
0
create() {
   ::create();
   set_name("armour");
   set_short("%^BOLD%^BLUE%^Raknid%^RESET%^RED%^ Battle Coccoon");
   set_long("This is custom artrell armour. It was forged by the"
	" firebreathe of a might Dragon Lord");
   set_ac(8);
   set_id(({"artrell armour", "armour"}));
Exemplo n.º 9
0
static int test_led_color(void)
{
	/* IDLE0 */
	set_ac(1);
	set_charge_state(ST_IDLE0);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));

	/* BAD_COND*/
	set_charge_state(ST_BAD_COND);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));

	/* PRE_CHARGING */
	set_charge_state(ST_PRE_CHARGING);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));

	/* IDLE */
	set_charge_state(ST_IDLE);
	set_battery_soc(50);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
	set_battery_soc(99);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* DISCHARGING */
	set_charge_state(ST_DISCHARGING);
	set_battery_soc(50);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
	set_battery_soc(99);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* CHARGING */
	set_charge_state(ST_CHARGING);
	set_battery_soc(50);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
	set_battery_soc(99);
	msleep(30000);
	TEST_ASSERT(verify_color(LED_COLOR_GREEN));

	/* CHARGING_ERROR */
	set_charge_state(ST_CHARGING_ERROR);
	msleep(1500);
	TEST_ASSERT(verify_color(LED_COLOR_RED));

	return EC_SUCCESS;
}
Exemplo n.º 10
0
void setup(void) {
   set_id("mithril chain mail");
   set_adj("mithril");
   add_ids("mithril mail", "mail", "chain mail");
   set_short("Mithril chain mail");
   set_long("It looks very light.");
   set_gettable(1);
   set_slot("body");
   set_ac(4);
   set_value(2500);
   set_size(3);
   set_weight(5);
}
Exemplo n.º 11
0
void setup(void) {
   set_id("gloves");
   set_adj("leather");
   set_short("A pair of leather gloves");
   set_long("A standard pair of adventurer's leather gloves.");
   set_gettable(1);
   set_slot("hands");
   set_wear_message("$N $vwear $o.");
   set_remove_message("$N $vremove $o.");
   set_value(20);
   set_weight(1);
	set_ac(2);
}
Exemplo n.º 12
0
void create() {
   ::create();
   set_name("staff");
   set_short("staff of the moralian's");
   set_long("This staff is a long crystal staff. It's total length is "
            "near 4 feet. Along it's length there is foggy liquid "
            "inside of it which is supposedly supposed to help out "
            "your minds inner eye.");
   set_wc(5);
   set_ac(1);
   set_type("blunt");
   set_value(0);
   set_mass(15);
}
Exemplo n.º 13
0
void setup(void) {
   set_id("helmet");
   set_short("A helmet");
   set_long("A helmet. This is very basic advenuterer's gear. " +
      "You better find something else.");
   set_gettable(1);

   set_ac(1);

   set_slot("head");
   set_value(20);
   set_size(2);
   set_weight(1);
}
Exemplo n.º 14
0
void setup(void) {
   set_id("hat");
   set_adj("black", "10 gallon");
   set_short("A black 10 gallon hat");
   set_long("This is one big hat.");
   set_gettable(1);

   set_ac(1);

   set_slot("head");
   set_value(20);
   set_size(5);
   set_weight(7);
}
Exemplo n.º 15
0
void create() {
	::create();
	set_name("amulet");
	set_short("Gemmed silver amulet");
	set_long("This amulet is made of pure silver with a transparent crystal gem covered with silver engravings.");
	set_ac(1);
	set_weight(1);
	
	set_type("amulet");
	set_value(3000);
	storage = 0;
	
	set_wear_modifier("int", 1, 2);
	add_property(({"artifact","magic","silver","crystal","metal"}));
Exemplo n.º 16
0
void setup( void ) {
  set_id( "shield" );
  set_adj( "round" );
  set_long( "A round shield." );
  set_in_room_desc( "A round shield." );
  set_gettable( 1 );

  set_ac( 2 );

  set_wield_type( "single" );
  set_wield_message( "$N $vwield $p $o." );
  set_unwield_message( "$N $vremove $p $o." );
  set_value( 1 );
  set_size( 10 );
}
Exemplo n.º 17
0
void setup(void) {
   set_id("jacket");
   set_adj("leather", "black");
   set_short("A worn but sturdy leather jacket");
   set_long("This is the kind of leather jacket all %^RED%^bad%^RESET%^ " +
      "dudes wear.  On the back is a lot of rivets making the " +
      "pattern of a star.");
   set_gettable(1);
   set_slot("body");
   set_wear_message("$N $vput on $o. Man, $N $vare cool!");
   set_remove_message("$N $vtake off $o, and suddenly $vlook extremely dull.");
   set_ac(3);
   set_value(50);
   set_weight(5);
}
Exemplo n.º 18
0
create() {
   ::create();
   call_flag = 0;
   set_id("cow");
   set_short("a cow");
   set_long("\
It's your average, everyday cow.  It eyes you with soft brown eyes as it\n\
contentedly munches its cud.  It'll probably be steaks pretty soon....\n");
   set_level(1);
   set_spell_chance(10);
   set_spell_dam(0);
   set_ac(3);
   set_wc(5);
   add_money(30);
}
Exemplo n.º 19
0
void setup(void) {
   set_id("helmet");
   set_adj("small", "round");
   set_short("A small rusty helmet");
   set_long("A small rusty helmet, it looks like it has seen better days.  " +
      "You would have to be really desperate to put this thing on.");
   set_gettable(1);

   set_ac(1);

   set_slot("head");
   set_value(20);
   set_size(10);
   set_weight(7);
}
Exemplo n.º 20
0
void setup(void) {
   set_id("t-shirt", "tshirt");
   set_adj("gurbalib");
   set_short("A flashy T-shirt");
   set_long("It reads: I crashed GurbaLib and all I got was this " +
      "stupid T-Shirt!");
   set_gettable(1);
   set_slot("torso");
   set_wear_message("$N $vput on $o, and suddenly $vlook a lot better.");
   set_remove_message("$N $vtake off $o, and suddenly $vlook dull.");
   set_ac(1);
   set_value(20);
   set_size(1);
   set_weight(3);
}
Exemplo n.º 21
0
void create()
{
 ::create();
 set_name("vip pass");
 set_short("A V.I.P. Pass to Beta-II");
 set_long("This pass allows you to set your stats/skills/level etc. "
          "to test out your area. It it attached to a clip where "
          "you can clip it to clothing.\n"
          "%^CYAN%^(commands):\n"
          "%^BLUE%^%^BOLD%^setstat\nsetskill\nsetlevel\nsetrace\n"
          "goto-area\nhome");
 set_mass(1);
 set_value(1);
 set_ac(1);
 set_type("name tag");
 set_id( ({ "vip pass", "pass" }) );
Exemplo n.º 22
0
static void
create() 
{
    ::create();
    set_name("Cloak of the Lord");
    set_short("an undescribable cloak");
    set_long("It is forever changing, and it can not be described in words.");
    set_type("cloak");
    set_ac(1);
    set_weight(1); 
    set_value(1111);
    add_property("wear_msg", "You feel strangely random in this cloak.\n");
    add_property("remove_msg", "You feel less random.\n");
    add_hook("__wear", store_fp("on_wear"));
    add_hook("__remove", store_fp("on_remove"));
}
Exemplo n.º 23
0
void setup(void) {
   set_id("crown");
   set_adj("metal");
   set_short("A metal crown");
   set_long("This crown functions as a useful helmet." +
      " It is a simple crown of metal but you know that it's ancient " +
      "and has rested upon the heads of champions throughout the " +
      "ages.");
   set_gettable(1);
   set_slot("head");
   set_wear_message("$N $vdon $o.");
   set_remove_message("$N $vtake off $o");
   set_ac(2);
   set_value(3000);
   set_size(3);
   set_weight(1);
}
Exemplo n.º 24
0
void setup(void) {
   add_ids("tower shield");
   set_adj("large");
   set_short("A large tower shield");
   set_long("A large tower shield It has an intricate holy symbol " +
		"elaborately created on the front of the tower shield. It is " +
		"heavy and sturdy.");
   set_gettable(1);

   set_ac(4);

   set_wield_type("single");
   set_wield_message("$N $vtake up $p $o.");
   set_unwield_message("$N $vremove $p $o.");
   set_value(1000);
   set_size(35);
   set_weight(3);
	add_bane("holy");
}
Exemplo n.º 25
0
void create_object(void)
{
    set_short("an old storyteller");
    set_long("An old, grey haired man dressed in a grey tunic. His " +
             "features are sharp and his deep blue eyes are bright and " +
             "intelligent. His long, slender fingers trace intricate " +
             "patterns trough the air as he tells epic tales of heroes " +
             "and villains. Maybe he would tell you a story about the "+
             "valley if you sat down at his table and asked?\n");
    set_name("storyteller");
    add_id("man");
    set_level(4);
    set_race("human");
    set_hp(100);
    set_al(350);
    set_gender(1);
    set_wc(6);
    set_ac(1);
    set_unarmed(1);
    add_money(200 + random(200));
}
Exemplo n.º 26
0
bool CMonster::ReplaceSoul(const MonsterInfo &info, bool boss)
{
	bBoss = boss;
	id = info.ID;
	name = info.name;
	set_head(info.Head);
	set_Lv(info.level);
	set_exp(info.exp);
	set_hp_m(info.hp);
	set_mp_m(info.mp);
	set_dc(info.DC1, info.DC2);
	set_mc(info.MC1, info.MC2);
	set_sc(0, 0);
	set_ac(info.AC, info.AC);
	set_mac(info.MAC, info.MAC);
	set_intervel(info.interval);

	QString str[10] = { QStringLiteral("ÆË»÷"), QStringLiteral("³åײ"), QStringLiteral("¿ÖÏÅ"), QStringLiteral("·É»÷"), QStringLiteral("Ó°»÷"),
		QStringLiteral("¶¾Êõ"), QStringLiteral("´ÎÉù²¨"), QStringLiteral("¼«ËÙ"), QStringLiteral("¾ÞÁ¦"), QStringLiteral("¼ṳ̀") };
	skill.name = str[qrand() % 10];
	return true;
}
Exemplo n.º 27
0
void create_object(void)
{
    set_short("Lallan the apothecary",1);
    set_long("Lallan is a man in his fifties with graying hair and blue " +
             "eyes.\n");
    set_name("apothecary");
    add_id("lallan");
    add_id("man");
    set_level(4);
    set_race("human");
    set_hp(100);
    set_al(200);
    set_gender(1);
    set_wc(6);
    set_ac(1);
    set_unarmed(1);
    add_property("no_flee");
    add_money(200 + random(200));

    load_chat(10,({ "Lallan says: Take my advice, leave while you still " +
                    "can.\n",
                    "Lallan says: If you're staying here, you'll be needing " +
                    "my wares.\n"
                  }));
Exemplo n.º 28
0
void setup(object tp, int ac) {
  if (!tp || !ac) return;
  owner=tp;
  set_ac(ac);
}