faction #216

Parent #1Owner #29Flags read, fertileSource hellcore/hellcore.db

Aliases: faction

11 verbs · 27 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
check_alignthis none thisrxd#21611
add_memberthis none thisrxd#2167
rm_memberthis none thisrxd#2167
change_reputation reputationthis none thisrxd#21629
_tell_standingsthis none thisrxd#21626
heartbeatthis none thisrxd#21625
tree_tagthis none thisrxd#2166
add_rep_itemthis none thisrxd#2165
add_rep_rewardthis none thisrxd#2163
set_max_standingthis none thisrxd#2163
set_rep_decaythis none thisrxd#2165

Properties

PropertyDefinerFlagsOwnerValue
alignment#216r#29{}
members#216r#29{}
sphere_of_influence#216r#29{}
standings#216r#29{}
reputation_items#216r#29{}
reputation_rewards#216r#29{}
max_standing#216r#29500
reaction_comments#216r#29{"Murderer!", "Killer!", "Assassin!", "SHIT!", "OHSHI-", "Run!"}
heart_tick#216r#290
negative_rep_decay#216r#295.0
positive_rep_decay#216r#29-1.0
decay_interval#216r#2986400
last_decay_time#216r#290
heart#216r#290
last_heartbeat#216r#290
positive_rep_decay_chance#216r#2910
clone_rep_min#216r#290
aliases#1rc#29{"faction"}
description#1rc#29<clear>
object_size#1r#29{7371, 1298433821}
hidden_verbs#1rc#29<clear>
phelp_msg#1rc#29<clear>
weight#1rc#29<clear>
owner_verbs#1rc#29<clear>
plural_name#1rc#29<clear>
client_image#1rc#29<clear>
listening#1rc#29<clear>

Ancestry

Ancestors (nearest first): #1 root

Children: none

Call graph

calls n216_3 #216:change_reputation n47_16 #47:slice n216_3->n47_16 n1_39 #1:dnamec n216_3->n1_39 n216_4 #216:_tell_standings n216_4->n47_16 n47_14 #47:sort n216_4->n47_14 n107_43 #107:tell n216_4->n107_43 n20_1 #20:left n216_4->n20_1 n20_59 #20:name_and_number n216_4->n20_59 n20_2 #20:right n216_4->n20_2 n216_6 #216:tree_tag n216_6->n20_2

Source

check_align

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1which = args[1];
2if (which == this)
3return 10;
4else
5for x in (this.alignment)
6if (x[1] == which)
7return x[2];
8endif
9endfor
10return 0;
11endif

add_member

Spec this none thisFlags rxdOwner #361Definer #216

Referenced by

none

Source

1who = args[1];
2if (!(who in this.members))
3this.members = setadd(this.members, who);
4endif
5if (!(this in who.factions))
6who.factions = setadd(who.factions, this);
7endif

rm_member

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1who = args[1];
2if (who in this.members)
3this.members = setremove(this.members, who);
4endif
5if (this in who.factions)
6who.factions = setremove(who.factions, this);
7endif

change_reputation reputation

Spec this none thisFlags rxdOwner #361Definer #216

Referenced by

none

Source

1who = toobj(args[1]);
2if (length(args) > 1)
3amount = tofloat(args[2]);
4endif
5if (!is_a(who, $creature))
6return E_INVARG;
7endif
8idx = who in $lu:slice(this.standings, 1);
9if (idx == 0)
10if (verb == "change_reputation")
11this.standings = setadd(this.standings, {who, amount});
12return amount;
13endif
14return 0.0;
15else
16if (verb == "change_reputation")
17if ((amount > 0.0) && (this.standings[idx][2] >= tofloat(this.max_standing)))
18who:tell($ansi.bold_on, "You already have the maximum reputation with ", this:dnamec(), ".", $ansi.bold_off);
19return;
20endif
21this.standings[idx][2] = this.standings[idx][2] + amount;
22color = $ansi.green + $ansi.bold_on;
23if (amount < 0.0)
24color = $ansi.red + $ansi.bold_on;
25endif
26who:tell((((((color + this:dnamec()) + " reputation: ") + tostr(amount)) + "/") + tostr(this.standings[idx][2])) + $ansi.reset);
27endif
28return this.standings[idx][2];
29endif

_tell_standings

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1if (length(args) > 0)
2who = args[1];
3idx = who in $lu:slice(this.standings, 1);
4if (idx == 0)
5return tofloat(idx);
6endif
7return this.standings[idx][2];
8endif
9data = this.standings;
10order = $Lu:slice(data, 2);
11data = $lu:sort(data, order);
12order = {};
13for a in (data)
14order = {@order, parent(a[1])};
15endfor
16data = $lu:sort(data, order);
17prev_parent = parent(data[1][1]);
18player:tell((($ansi.bold_on + $ansi.yellow) + "--------------------------") + $ansi.reset);
19for a in (data)
20if (parent(a[1]) != prev_parent)
21player:tell((($ansi.bold_on + $ansi.yellow) + "--------------------------") + $ansi.reset);
22endif
23player:tell($su:left($su:nn(a[1]), 30), " ", $su:right(tostr(tofloat(a[2])), 7));
24prev_parent = parent(a[1]);
25yield;
26endfor

heartbeat

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1if ((time() - this.last_decay_time) > this.decay_interval)
2this.last_decay_time = time();
3count = 1;
4for a in (this.standings)
5yield;
6if (tofloat(a[2]) < 0.0)
7if (abs(tofloat(a[2])) < this.negative_rep_decay)
8this.standings[count][2] = 0.0;
9else
10this.standings[count][2] = tofloat(this.standings[count][2]) + this.negative_rep_decay;
11endif
12endif
13if (tofloat(a[2]) > 0.0)
14if (random(100) > this.positive_rep_decay_chance)
15if (abs(tofloat(a[2])) < this.positive_rep_decay)
16this.standings[count][2] = 0.0;
17else
18this.standings[count][2] = tofloat(this.standings[count][2]) + this.positive_rep_decay;
19endif
20endif
21endif
22count = count + 1;
23yield;
24endfor
25endif

tree_tag

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1tag = $su:right(tostr(this.positive_rep_decay), -5);
2tag = ((tag + ", ") + $su:right(tostr(this.positive_rep_decay_chance), -5)) + "%";
3tag = (tag + ", ") + $su:right(tostr(this.negative_rep_decay), -5);
4tag = ((tag + ", ") + $su:right(tostr(this.decay_interval / 3600), -3)) + "h";
5tag = (tag + ", ") + $su:right(tostr(this.max_standing), -8);
6return $su:right(tag, 30);

add_rep_item

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1"Copied from Cybus Technology (#547474):add_rep_item by Hawgpadre (#538008) Fri Feb 11 15:47:45 2011 CST";
2what = args[1];
3if (valid(what))
4this.reputation_items = setadd(this.reputation_items, what);
5endif

add_rep_reward

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1"Copied from Cybus Technology (#547474):add_rep_reward by Hawgpadre (#538008) Fri Feb 11 15:47:45 2011 CST";
2what = args[1];
3this.reputation_rewards = setadd(this.reputation_rewards, what);

set_max_standing

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1"Copied from Cybus Technology (#547474):set_max_standing by Hawgpadre (#538008) Fri Feb 11 15:47:45 2011 CST";
2max_standing = toint(args[1]);
3this.max_standing = max_standing;

set_rep_decay

Spec this none thisFlags rxdOwner #29Definer #216

Referenced by

none

Source

1"Copied from Cybus Technology (#547474):set_rep_decay by Hawgpadre (#538008) Fri Feb 11 15:47:45 2011 CST";
2this.negative_rep_decay = tofloat(args[1]);
3this.positive_rep_decay = tofloat(args[2]);
4this.decay_interval = toint(args[3]);
5this.positive_rep_decay_chance = toint(args[4]);