varargs int effective_light(object ob) { object *inv; int i, x; if( !ob ) ob = previous_object(); x = total_light(ob) + ob->GetSightBonus(); i = sizeof(inv = all_inventory(ob)); while(i--) x += inv[i]->GetRadiantLight(); return x; }
int cmd_peek(string str) { object ob; if (!abil()) { return 0; } if(!str) { notify_fail("Peek at what?\n"); return 0; } str = lower_case(str); if(str = this_player()->query_name()) return 0; if(sscanf(str, "at %s", str) != 1) { notify_fail("Peek at what?\n"); return 0; } if(this_player()->query_disabled()) return 1; this_player()->set_disabled(); ob = environment(this_player()); if(effective_light(this_player()) < 0) { write("It is too dark."); return 1; } if(total_light(this_player()) < 1) write("It is dark.\n"); if(ob->id(str)) write((string)ob->query_long(str)); else if(ob = present(str, this_player())) write((string)ob->query_long(str)); else if(ob = present(str, environment(this_player()))) write((string)ob->query_long(str)); else { write("You do not notice that here."); return 1; } /* if(random(40) > (int)this_player()->query_skill("stealth")) { if(living(ob)) { say(this_player()->query_cap_name()+" glances at "+ob->query_cap_name()+" slyly.", ob); tell_object(ob, this_player()->query_cap_name()+" glances at you slyly."); } else say(this_player()->query_cap_name()+" looks over the "+str+"."); } else */ this_player()->add_skill_points("stealth", 1); return 1; }
int cmd_give(string str) { object ob, to; string what, who, type; int i, amount; int dummy; // object *inv; if (!stringp(str)) return help(); dummy = total_light(this_player()); if(dummy < -6) { write("It is too dark.\n"); return 1; } if (sscanf(str,"%s to %s", what, who) != 2) { return help(); } if(who == "me" || who == "myself") { who = this_player()->query_name(); } to = present(who, environment(this_player())); if (!to) { notify_fail("Give "+what+" to who?\n"); return 0; } ob = present(what, this_player()); if (ob) if (ob->give(what)) return 1; if (!ob) { ob = parse_objects(this_player(), what); } if(!ob) { if(sscanf(what, "%d %s coin", amount, type) !=2) { return notify_fail("You must have an object to give it away!\n"); } // wiz fixed this, you were able to give 0 coins to people if (amount<1) { return notify_fail("Please enter a valid amount.\n"); } if(amount > (int)this_player()->query_money(type)) { return notify_fail("You don't have that much!\n"); } if(query_ip_number(this_player()) == query_ip_number(to) && this_player()->query_name() != to->query_name() ) { CHAT_D->do_raw_chat("system", "Multi <system> Exchange of money between "+this_player()->query_name()+" and "+to->query_name()); seteuid("Log"); log_file("multiplay", "Exchange of money ("+amount+" "+type+") between "+this_player()->query_name()+" and "+to->query_name()+" from "+query_ip_number(this_player())+". (give)\n"); seteuid(getuid()); } this_player()->add_money(type, -amount); to->add_money(type, amount); if (to->is_monster()) { to->remove_property("gave_money"); to->set_property("gave_money", 1); } write("You give " + amount + " " + type + " coins to " + to->query_cap_name() + ".\n"); message("no_wrap",this_player()->query_cap_name()+ " gives some money to " + to->query_cap_name() + ".\n", environment(this_player()),({ this_player(), to })); tell_object(to, this_player()->query_cap_name() + " gives you " + amount + " " + type + " coins.\n"); return 1; }